package cn.wx.jove.core.service;


import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.wx.jove.core.entity.Stockdatafromtl;
import cn.wx.common.persistence.base.BaseService;
import cn.wx.jove.core.mapper.StockdatafromtlMapper;
import cn.wx.common.persistence.exception.MyException;
import cn.wx.common.persistence.web.ResponseCode;


/**
 * <p>
 *  服务类
 * </p>
 *
 * @author  
 * @since 2018-12-03
 */
@Service
@Transactional
public class StockdatafromtlService extends BaseService<Stockdatafromtl, StockdatafromtlMapper> {

	/**
	 * 新增
	 * @param stockdatafromtl
	 * @return
	 * @throws MyException 
	 */
	 public boolean create(Stockdatafromtl stockdatafromtl) throws MyException{
	 	return insert(stockdatafromtl);
	 }
	 
	 /**
	 * 修改
	 * @param stockdatafromtl
	 * @return
	 * @throws MyException 
	 */
	public boolean modify(Stockdatafromtl stockdatafromtl) throws MyException{
		// PID 不能为空
		if (stockdatafromtl.getpId() == null) {
			throw new MyException(ResponseCode.PARAMETER_REQUIRED);
		}
		return update(stockdatafromtl);
	}
	
	/**
	 * 删除
	 * @param stockdatafromtl
	 * @return
	 * @throws MyException 
	 */
//	public boolean remove(Stockdatafromtl stockdatafromtl) throws MyException{
//		// PID 不能为空
//		if (stockdatafromtl.getpId() == null) {
//			throw new MyException(ResponseCode.PARAMETER_REQUIRED);
//		}
//		stockdatafromtl.setfRemove(true);
//		return update(stockdatafromtl);
//	}

	/**
	 * 查询最大nid数据
	 * @param stockdatafromtl
	 * @return
	 * @throws MyException 
	 */
	public Stockdatafromtl queryMax() {
		return simpleMapper.queryMax();
	}
}
